package com.dylan.equipment.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dylan.equipment.dao.IEquipmentTypeDao;
import com.dylan.equipment.entity.EquipmentType;
import com.dylan.equipment.entity.PageBean;
import com.dylan.equipment.utils.StringUtil;

@Service
public class EquipmentTypeService {
	
	
	@Resource
	private IEquipmentTypeDao equipmentTypeDao;
	
	public List<EquipmentType> find (PageBean page,EquipmentType type){
		Map<String, Object> params = new HashMap<>();
		if(page!=null){
			params.put("start", page.getStart());
			params.put("pageSize", page.getPageSize());
		}
		if(StringUtil.isNotEmpty(type.getTypeName())){
			params.put("typeName", type.getTypeName());
		}
		return equipmentTypeDao.find(params);
	}

	public int count(EquipmentType s_equipmentType){
		return equipmentTypeDao.count(s_equipmentType);
	}

	public void add(EquipmentType equipmentType){
		equipmentTypeDao.add(equipmentType);
	}

	public void update(EquipmentType equipmentType){
		equipmentTypeDao.update(equipmentType);
	}

	public void delete(int id){
		equipmentTypeDao.delete(id);
	}

	public EquipmentType loadById(int id){
		return equipmentTypeDao.loadById(id);
	}
}
